'use strict';


// Declare app level module which depends on filters, and services
var app = angular.module('intracks', [
        'ngRoute',
        'intracks.filters',
        'intracks.services',
        'intracks.controllers',
        'xeditable',
        'ui.bootstrap',
        'ui.select2',
        'ngAnimate',
        'ui.bootstrap.datetimepicker',
        'btford.socket-io',
        'cgBusy'
    ]).
    config(['$routeProvider', function($routeProvider) {
        $routeProvider.when('/', {
            templateUrl: jsRoutes.controllers.Assets.at('partials/index.html').url,
            controller: 'IndexCtrl',
            resolve: function(){

            }
        });
        $routeProvider.when('/stations', {
            templateUrl: jsRoutes.controllers.Assets.at('partials/stations.html').url,
            controller: 'StationsCtrl',
            resolve: function(){

            }
        });
        $routeProvider.when('/mapView', {
            templateUrl: '/assets/partials/mapView.html',
            controller: 'MapViewCtrl',
            resolve: function(){

            }
        });
        $routeProvider.when('/TagtoObject', {
            templateUrl: '/assets/partials/tagToObject.html',
            controller: 'TagToObjectCtrl',
            resolve: function(){

            }
        });
        $routeProvider.when('/realTimeMap', {
            templateUrl: '/assets/partials/realTimeMap.html',
            controller: 'RealTimeMapCtrl',
            resolve: function(){

            }
        });
        $routeProvider.when('/quantitativeGraph', {
            templateUrl: '/assets/partials/quantitativeGraph.html',
            controller: 'QuantitativeGraphCtrl',
            resolve: function(){

            }
        });
        $routeProvider.when('/averagesGraph', {
            templateUrl: '/assets/partials/averagesGraph.html',
            controller: 'AveragesGraphCtrl',
            resolve: function(){

            }
        });
        $routeProvider.when('/login', {
            templateUrl: '/login',
            controller: 'MapViewCtrl',
            resolve: function(){

            }
        });
        $routeProvider.when('/logout', {
            templateUrl: '/logout',
            controller: 'MapViewCtrl',
            resolve: function(){

            }
        });
//        $routeProvider.otherwise({redirectTo: '/'});
    }]);

app.run(function(editableOptions, editableThemes) {
    editableThemes.bs3.inputClass = 'input-sm';
    editableThemes.bs3.buttonsClass = 'btn-sm';
    editableOptions.theme = 'bs3';
});

app.factory('messagesSocketIO', function () {
    // This for handling webSocket for notifications
    var WS = window['MozWebSocket'] ? MozWebSocket : WebSocket;
    var notificationsSocket = new WS(jsRoutes.controllers.MessagesController.liveNotifications().webSocketURL());
    return notificationsSocket;
});

var controllers = angular.module('intracks.controllers', []);

